// app.js
App({
  onLaunch: function () {
    // 全局获取一次系统和胶囊信息
    // 获取系统信息
    wx.getSystemInfo({
      success: res => {
        this.globalData.system = res
      }
    })
    // 获取胶囊信息
    this.globalData.capsule = wx.getMenuButtonBoundingClientRect()
    this.globalData.capsuleTop = this.globalData.capsule.top
    this.globalData.capsuleHeight = this.globalData.capsule.height
    this.globalData.navbarHeight = (this.globalData.capsule.top - this.globalData.system.statusBarHeight) * 2 + this.globalData.capsule.height + this.globalData.system.statusBarHeight
  },
  globalData: {
    userInfo: null,
    system: '',
    capsule: '',
    capsuleTop: '', //胶囊距离屏幕顶部的距离
    capsuleHeight: '', //胶囊高度
    navbarHeight: '' //导航栏高度
  }
})